import request from '@/utils/request'

export default {
    // 根据课程id和用户id进行下单
    createOrder(courseId, userId) {
        return request({
            url: `/orderservice/Torder/createOrder/` + courseId + `/` + userId,
            method: 'get',
        })
    },
    getOrderById(orderId) {
        return request({
            url: `/orderservice/Torder/getOrderById/` + orderId,
            method: 'get',
        })
    },
    toPay(orderInfo) {
        return request({
            url: `/orderservice/t-pay-log/toPay/`,
            method: 'post',
            data: orderInfo,
        })
    },

    // 分页条件查询订单信息
    getPageList(current, limit, search) {
        return request({
            url: `/orderservice/Torder/getPageList/` + current + `/` + limit,
            method: 'post',
            data: search
        })
    },
    // 根据订单id删除订单信息
    deleteOrder(orderId) {
        return request({
            url: `/orderservice/Torder/deleteOrder/` + orderId,
            method: 'get',
        })
    },
    // 根据订单id获取订单信息
    getOrderById(orderId) {
        return request({
            url: `/orderservice/Torder/getOrderById/` + orderId,
            method: 'get',
        })
    },
    // 查询所有的课程信息
    selectCourseInfo() {
        return request({
            url: `/eduservice/course/getCourseInfoList/`,
            method: 'get',
        })
    },
    // 根据订单id和订单实体类更新订单信息
    updateOrder(orderId, orderEntity) {
        return request({
            url: `/orderservice/Torder/updateOrder/` + orderId,
            method: 'post',
            data: orderEntity
        })
    },

}